package com.dwzlab.servlet;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;


/**
 * @author zhuxiaodong
 *
 */
public class LookUpAjax extends HttpServlet {
	private static final long serialVersionUID = 1L;
       

	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		doPost(request, response);
	}

	
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
//		List<XUser> xUsers = new ArrayList<XUser>();
		StringBuffer sb = new StringBuffer("[");
		for(int i=0;i<5;i++){
//			XUser xUser = new XUser();
//			xUser.setId(i);
//			xUser.setE_name("merry"+i);
			sb.append("{\"id\":\""+i+"\",\"e_name\":\"merry"+i+"\"},");
		}
		String str = sb.substring(0,sb.length()-1);
		str += "]";
//		String str = "[" +
//				"{\"id\":\"1\",\"orgName\":\"aaa\",\"orgNum\":\"1001\"}," +
//				"{\"id\":\"2\",\"orgName\":\"bbb\",\"orgNum\":\"1002\"}," +
//				"{\"id\":\"3\",\"orgName\":\"ccc\",\"orgNum\":\"1003\"}," +
//				"{\"id\":\"4\",\"orgName\":\"ddd\",\"orgNum\":\"1004\"}" +
//				"]";
//		response.getWriter().write(new Gson().toJson(xUsers));
		response.getWriter().write(str);
	}

}
